home *** CD-ROM | disk | FTP | other *** search
- Path: ip-salem3-15.teleport.com!user
- From: dynamix@teleport.com (Steve Budrys)
- Newsgroups: comp.lang.c++
- Subject: Re: ???Recursion and strings
- Date: Fri, 09 Feb 1996 13:48:54 -0800
- Organization: Dynamix Trading
- Message-ID: <dynamix-0902961348540001@ip-salem3-15.teleport.com>
- References: <4f44fg$74u@upsidedown.MTS.Net> <31188b9a.12102227@news.kreonet.re.kr>
- NNTP-Posting-Host: ip-salem3-15.teleport.com
-
- In article <31188b9a.12102227@news.kreonet.re.kr>, jwhahn@cair.kaist.ac.kr
- (Jung Hahn) wrote:
-
- > foo( char *s, int len)
- > {
- > static int count=0;
- >
- > if ( count++ < len) {
- > printf( "%c", *s++);
- > foo( s, len);
- > }
- > }
- >
- > void main( void)
- > {
- > char *t = "Hello World\n";
- >
- > foo( t, strlen(t));
- > }
-
-
- or if you'd like to use foo more than once,
-
- foo(char *s)
- {
- if(*s!=0)
- {
- printf(("%c",*s++);
- foo(s);
- }
- }
-
- -Monique
- Dynamix Trading
-